home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
pascal
/
pnl003.zip
/
TOKEN.PAS
< prev
Wrap
Pascal/Delphi Source File
|
1990-05-30
|
14KB
|
173 lines
{************************************************************************
**
** Token.pas Advanced string handling procedures.
**
** Written by G.Hoogterp
** All Copyrights reserved
** Version 1.0
**
** Use this unit as you like, you may modify it for personal use.
** you may NOT distribute a modified version though!
**
*************}
Unit Token;
Interface
{***********************************************************************
**
** Findtoken splits a tokenlist into a head and a tail.
**
**********}
Function FindToken(Var TokenList : String;Delimiters : String):String;
{***********************************************************************
**
** SimplifyDelimiter simplifies the delimiters in a tokenlist.
**
**********}
Procedure SimplifyDelimiters(Var TokenList : String;Delimiters : String);
{***********************************************************************
**
** SkipLeadingSpaces deletes the leading spaces of a tokenlist
**
**********}
Procedure SkipLeadingSpaces(Var TokenList : String);
{***********************************************************************
**
** DeletetrailingSpaces deletes the trailing spaces of a tokenlist
**
**********}
Procedure DeleteTrailingSpaces(Var TokenList : String);
{***********************************************************************
**
** UpStr converts a tokenlist to all uppercase
** DownStr converts a tokenlist to all lowercase
**
**********}
Procedure UpStr(Var TokenList : String);
Procedure DownStr(Var TokenList : String);
{***********************************************************************
**
** Delete noise deletes all charactes you don't want to find in a tokenlist.
**
**********}
Procedure DeleteNoise(Var TokenList : String;Noise : String);
{***********************************************************************
**
** Replace token can be used to change multiletter delimiters into
** single letter delimiters. (Or an other multiletter delimiter)
**
**********}
Procedure ReplaceToken(Var TokenList : String;Tok1,Tok2 : String);
Implementation
Function FindToken(Var TokenList : String;Delimiters : String):String;
Var HStr : String;
Tel : Byte;
Begin
HStr:='';
Tel:=1;
While (Tel<=Length(TokenList)) And
(Pos(UpCase(TokenList[Tel]),Delimiters)=0) Do
HStr:=HStr+TokenList[Tel];
Inc(Tel);
End;
FindToken:=HStr;
Delete(TokenList,1,Tel);
End;
Procedure SimplifyDelimiters(Var TokenList : String;Delimiters : String);
Var DelTel : Byte;
Begin
DelTel:=1;
Repeat
If (Pos(TokenList[DelTel],Delimiters)>0) And
(Pos(TokenList[DelTel+1],Delimiters)>0)